<template>
    <div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>权益名称</td>
                    <td><input type="text" v-model="add.qname"></td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="radio" v-model="add.tyle" name="tyle" :value=true>启用
                        <input type="radio" v-model="add.tyle" name="tyle" :value=false>禁用
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="添加权益" @click="ok"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref, reactive, onMounted } from "vue";
import moment from 'moment';
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();

let add: any = reactive(
    {
        "qname": "",
        "tyle": true,
        "isdel": true
    }
)
const ok = () => {
    axios(
        {
            url: 'https://localhost:7104/api/Emp/addq',
            method: 'post',
            data: add
        }
    )
        .then(res => {
            console.log(res);
            if(res.data==-1)
        {
            alert("此权益已经拥有");
            return;
        }
            if (res.data > 0) {
                alert("添加成功");
                router.push("/Qshow")
            }
        })
        .catch(err=>{
            console.log(err);
            
        })
}
</script>

<style scoped></style>